package lxh.ioc;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import lxh.ioc.ioc.CheckNet;
import lxh.ioc.ioc.OnClick;
import lxh.ioc.ioc.ViewById;
import lxh.ioc.ioc.ViewUtils;

public class MainActivity extends AppCompatActivity {
    @ViewById(R.id.tv1)
    private TextView mTextView;
    @ViewById(R.id.tv2)
    private TextView mTextView2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ViewUtils.inject(this);
        mTextView.setText("测试一把");
    }
    @OnClick({R.id.tv1,R.id.tv2})
    @CheckNet(remindMsg = "未检测到网络")
    private void test(View view){
        switch (view.getId()){
            case R.id.tv1:
                Toast.makeText(this,mTextView.getText().toString(),Toast.LENGTH_LONG).show();
                break;
            case R.id.tv2:
                Toast.makeText(this,mTextView2.getText().toString(),Toast.LENGTH_LONG).show();
                break;
        }

    }

}
